#ifndef ADRENO_CMD_H
#define ADRENO_CMD_H

#include <unistd.h>

#define CP_TYPE4_PKT    (4 << 28)
#define CP_TYPE7_PKT    (7 << 28)

#define CP_NOP                  0x10
#define CP_WAIT_FOR_ME          0x13
#define CP_WAIT_FOR_IDLE        0x26
#define CP_WAIT_REG_MEM         0x3c
#define CP_MEM_WRITE            0x3d
#define CP_INDIRECT_BUFFER_PFE  0x3f
#define CP_SET_DRAW_STATE       0x43
#define CP_MEM_TO_MEM           0x73
#define CP_SET_PROTECTED_MODE   0x5f

#define upper_32_bits(n) ((uint32_t)(((n) >> 16) >> 16))
#define lower_32_bits(n) ((uint32_t)(n))

uint cp_gpuaddr(uint *cmds, uint64_t gpuaddr);

uint pm4_calc_odd_parity_bit(uint val);

uint cp_type7_packet(uint opcode, uint cnt);

uint cp_wait_for_me(uint *cmds);

uint cp_mem_packet(int opcode, uint size, uint num_mem);

uint cp_wait_for_idle(uint *cmds);

uint cp_type4_packet(uint opcode, uint cnt);

uint cp_register(unsigned int reg, unsigned int size);

uint cp_invalidate_state(uint *cmds);

#endif
